package org.supda.system.controller.monitor;

import java.util.List;

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.supda.system.controller.common.BaseController;
import org.supda.system.entity.system.DiskEntity;
import org.supda.system.service.TMessageSendService;
import org.supda.system.service.TMessageService;

/**
 * 实时信息控制器
 * @author supda
 * @Date 2017-2-24 下午3:38:59
 *
 */
@Controller
@RequestMapping("/actual")
public class ActualController extends BaseController{

	@Inject private TMessageSendService messageSendService;
	
	@Inject private TMessageService messageService;
	/**
	 * 进入监控实时曲线页面
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping(value = {"/rate"}, method=RequestMethod.GET, produces="text/html;charset=utf-8")
	public String actualRate(HttpServletRequest request, Model model){
		model.addAttribute("menuId",getOID());
		return SYSTEM_MONITOR_VIEW_PACKAGE+"actual/actual-rate";
	}
	
	/**
	 * 进入监控磁盘页面
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping(value = {"/disk"}, method=RequestMethod.GET, produces="text/html;charset=utf-8")
	public String actualDisk(HttpServletRequest request, Model model){

		List<DiskEntity> disks  = messageService.revertAllDisksInfo();

		if(disks!=null && disks.size()>0)
			model.addAttribute("disks", disks);
		
		return SYSTEM_MONITOR_VIEW_PACKAGE+"actual/actual-disk";
	}
	
	/**
	 * 实时监控
	 */
	@RequestMapping(value = "/search")
	public void searchActual(HttpServletRequest request ){
		
	}
}
